package eclipse.lib.map;
/**
 * TileAttribute enum functions as an option selection for Eclipse's Tile system.
 */
/*
 * Copyright (c) 2009, TOD Productions All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
 *	- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
 *	- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
 *	-Neither the name of the organization nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 */
public enum TileAttribute 
{
	/** NONE specifies that the tile has no special attributes */
	NONE		((byte)	0x00),
	/** BLOCK specifies that the tile is blocked for all Character-type objects */
	BLOCK 		((byte)	0x01),
	/** NPC_BLOCK specifies that the tile is blocked only to NPC-type objects */
	NPC_BLOCK	((byte)	0x02),
	/** GUILD_BLOCK specifies that the tile is blocked only to a specific Guild */
	GUILD_BLOCK	((byte)	0x03),
	/** ITEM specifies that the tile is an Item spawn */
	ITEM		((byte)	0x04),
	/** KEY specifies that the tile acts as a locked tile and requires a "Key Event" to open */
	KEY			((byte)	0x05),
	/** KEY_OPEN specifies that the tile acts as a trigger for a "Key Event" */
	KEY_OPEN	((byte)	0x06),
	/** ROOF specifies that the tile is shown only when the current player is not under it */
	ROOF		((byte)	0x07),
	/** SCRIPTED specifies that the tile triggers a script */
	SCRIPTED	((byte) 0x08),
	/** SIGN specifies that the tile blocks and displays 3 lines of text */
	SIGN		((byte) 0x09),	
	ARENA		((byte) 0x0A),
	/** BANK specifies that the tile triggers a bank events */
	BANK		((byte) 0x0B),
	/** HOUSE specifies that the tile triggers a house purchace event */
	HOUSE		((byte) 0x0C),
	/** CLICKABLE specifies that if the tile is clicked, it triggers a script */
	CLICKABLE	((byte) 0x0D),
	/** SHOP specifies that the tile triggers a shop event */
	SHOP		((byte) 0x0E)
	;
	
	private final byte value;
	private TileAttribute(byte value)
	{
		this.value = value;
	}
	/**
	 * This gets the value associated with the specified enum
	 * @return The value as a byte specifying the enum
	 */
	public final byte getValue()
	{
		return value;
	}
	/**
	 * This gets the enum associated with a specified value
	 * @param value A byte which is associated with a single enum
	 * @return The enum that is specified by the byte
	 */
	public static final TileAttribute getAttribute(byte value)
	{
		for(TileAttribute a: TileAttribute.values())
		{
			if(a.getValue() == value)
				return a;
		}
		return TileAttribute.NONE;
	}
	public static final int getSize()
	{
		int x = 0;
		for(
			@SuppressWarnings("unused") 
			TileAttribute a: TileAttribute.values())		
			x++;		
		return x;
	}
}
